package com.example.springwebfluxdoc.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * SpringDoc OpenAPI配置类
 * 用于自定义API文档的基本信息
 */
@Configuration
public class OpenApiConfig {

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("Spring WebFlux API文档")
                        .version("1.0")
                        .description("基于Spring WebFlux和SpringDoc OpenAPI构建的在线接口文档示例项目")
                        .termsOfService("http://example.com/terms")
                        .contact(new io.swagger.v3.oas.models.info.Contact()
                                .name("开发者")
                                .email("developer@example.com")
                                .url("http://example.com"))
                        .license(new io.swagger.v3.oas.models.info.License()
                                .name("Apache 2.0")
                                .url("http://springdoc.org")));
    }

}